<form method="post" action="{$formAction}">
  <div class="ow_admin_permissions ow_automargin ow_wide ow_stdmargin ow_center">
    <table class="ow_table_2 ow_form ow_automargin ow_wide">
        <tr>
            <td></td>
            {foreach from=$moderators item='moderator'}
                {assign var='moderatorId' value=$moderator->id}
                {assign var='userId' value=$moderator->userId}
                <th width="1">
                    {decorator name='avatar_item' data=$avatars[$userId]}
                </th>
            {/foreach}
        </tr>
        {foreach from=$groups item='group'}
            {assign var=groupName value=$group->name}
            <tr class="{cycle values='ow_alt1,ow_alt2'}">
                <td class="ow_txtleft">{$groupLabels[$groupName]}</td>
                {foreach from=$moderators item='moderator'}
                    {assign var='groupId' value=$group->id}
                    {assign var='moderatorId' value=$moderator->id}
                    <td><input {if $moderator->id == $superModeratorId or ($myModeratorId != $superModeratorId and $groupId == $adminGroupId)} disabled="disabled"{/if} type="checkbox" name="perm[]" value="{$moderatorId}:{$groupId}" {if isset($perms.$moderatorId.$groupId) or $moderator->id == $superModeratorId} checked="checked"{/if} /></td>
                {/foreach}
            </tr>
        {/foreach}
        <tr>
            <td></td>
            {foreach from=$moderators item='moderator'}
                {assign var='moderatorId' value=$moderator->id}
                {assign var='userId' value=$moderator->userId}
                <td>
                    {if $moderator->id !== $myModeratorId and $moderator->id !== $superModeratorId}
                        <a href="{$deleteModerUrls[$userId]}" onclick="return confirm('{text key="base+are_you_sure"}');" style="width:16px; height:16px; display:block; margin:0 auto;background-repeat:no-repeat;background-position: 50% 50%;" class="ow_ic_delete"></a>
                    {/if}
                </td>
            {/foreach}
        </tr>
    </table>
    <div class="clearfix"><div class="ow_right">{decorator name='button' langLabel='admin+permissions_index_save' class='ow_button ow_ic_save ow_positive' onclick='this.form.submit();'}</div></div>
  </div>
</form>

<form method="post" action="{$addFormAction}">
<div class="ow_wide ow_automargin">
	{capture name='add_new'}{text key='admin+permissions_moders_add_moder'}{/capture}

    {block_decorator name='box_cap' iconClass='ow_ic_moderator' label=$smarty.capture.add_new}{/block_decorator}
    
    <div class="ow_box ow_stdmargin clearfix ow_center">{text key='admin+permissions_moders_username'} <input type="text" name="username" style="width: 170px" />
    	{decorator name='button' langLabel='admin+permissions_moders_make_moderator' type="submit"}
    </div>
    
</div>
</form>